package org.jeecg.chase.modules.model;

import lombok.Data;
import org.jeecg.chase.modules.entity.AdhShopCategory;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author leikai
 * @version 1.0
 * @description:
 * @date 2022/01/08/0008 16:52
 */
@Data
public class AdhShopCategoryTree implements Serializable {

    private static final long serialVersionUID = 1L;

    private String id;
    /**
     * 父机构ID
     */
    private String parentId;

    /*
     * 分类名称
     */
    private String categoryName;

    /*
     * 级别，1为一级分类;2为二级分类
     */
    private Integer categoryLevel;
    /*
     * 状态，1启用;0停用
     */
    private Boolean categoryStatus;
    /*
     * 排序
     */
    private Integer categoryOrder;

    /**
     * 创建人
     */
    private String createBy;
    /**
     * 创建日期
     */
    private Date createTime;
    /**
     * 更新人
     */
    private String updateBy;
    /**
     * 更新日期
     */
    private Date updateTime;

    private String iconImg;
    private List<AdhShopCategoryTree> children;

    public AdhShopCategoryTree(AdhShopCategory adhShopCategory) {
        this.id = adhShopCategory.getId();
        this.parentId = adhShopCategory.getParentId();
        this.categoryName = adhShopCategory.getCategoryName();
        this.iconImg = adhShopCategory.getIconImg();
        this.categoryLevel = adhShopCategory.getCategoryLevel();
        this.categoryStatus = adhShopCategory.getCategoryStatus();
        this.categoryOrder = adhShopCategory.getCategoryOrder();
        this.createBy = adhShopCategory.getCreateBy();
        this.createTime = adhShopCategory.getCreateTime();
        this.updateBy = adhShopCategory.getUpdateBy();
        this.updateTime = adhShopCategory.getUpdateTime();
        if (adhShopCategory.getCategoryLevel() != 2) {
            this.children = new ArrayList<AdhShopCategoryTree>();
        }
    }
}
